package com.example.plugina;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;

import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.shadowcore.ContextTheme;
import com.example.shadowcore.constants.GlobalConstants;

/**
 * Author: chinadragon
 * Time: 2023/9/13 18:50
 */
public class ShadowContext implements ContextTheme {
    public Activity mActivity;
    @Override
    public void attch(Activity attchActivity) {
        mActivity = attchActivity;

    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {


    }

    public  void setContentView(@LayoutRes int layoutResID){
        mActivity.setContentView(layoutResID);
    }

    public <T extends View> T findViewById(@IdRes int id) {
        return mActivity.findViewById(id);
    }

    public void startActivity(Intent intent) {
        Intent m = new Intent();
//        里面 有很多 取
        m.putExtra(GlobalConstants.KEY_CLASSS_NAME, intent.getComponent().getClassName());
        mActivity.startActivity(m);
    }



    @Override
    public void onStart() {

    }

    @Override
    public void onRestart() {

    }

    @Override
    public void onResume() {

    }

    @Override
    public void onPause() {

    }

    @Override
    public void onStop() {

    }

    @Override
    public void onDestroy() {

    }

    @Override
    public void finish() {

    }

    @Override
    public void onSaveInstanceState(@NonNull Bundle outState) {

    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return false;
    }

    @Override
    public void onBackPressed() {

    }
}
